/**
 * 
 */
package com.an.nopro.app.framework.redis.respository;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Repository;

import com.an.nopro.app.framework.entity.Person;

/**
 * @author Administrator
 *
 */
@Repository
public class PersonRedisDao {

	/**
	 * 针对键值都是字符型的数据操作。
	 */
	@Autowired
	private StringRedisTemplate redisTemplate;

	@Resource(name = "stringRedisTemplate")
	private ValueOperations<String, String> operations;

	@Autowired
	private RedisTemplate<Object, Object> redisTemplate2;

	@Resource(name = "redisTemplate")
	private ValueOperations<Object, Object> operations2;

	/**
	 * 保存对象
	 * 
	 * @param person
	 */
	public void save(Person person) {
//		redisTemplate.
		operations2.set(person.getId() + "", person);
	}

	public Person getPerson(long id) {
		return (Person) operations2.get(id + "");
	}
}
